

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/fluid.png">
  <link rel="icon" href="/img/fluid.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="Jiashi">
  <meta name="keywords" content="">
  
    <meta name="description" content="缓冲区溢出（栈溢出）">
<meta property="og:type" content="article">
<meta property="og:title" content="缓冲区溢出">
<meta property="og:url" content="https://jiashi19.gitee.io/2023/10/12/%E7%BC%93%E5%86%B2%E5%8C%BA%E6%BA%A2%E5%87%BA/index.html">
<meta property="og:site_name" content="Blog from js19">
<meta property="og:description" content="缓冲区溢出（栈溢出）">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://s2.loli.net/2023/10/12/1YpmFTXMvhksjLx.png">
<meta property="og:image" content="https://s2.loli.net/2023/10/12/lfHpyKtexSC4oq1.png">
<meta property="og:image" content="https://s2.loli.net/2023/10/12/NxS5aRwYLUHsAuv.png">
<meta property="og:image" content="https://s2.loli.net/2023/10/12/YxiulWDVBF9fSZw.png">
<meta property="og:image" content="https://s2.loli.net/2023/10/12/hQ2SNwo9XJYKskO.png">
<meta property="article:published_time" content="2023-10-12T10:12:52.000Z">
<meta property="article:modified_time" content="2023-10-18T06:33:41.093Z">
<meta property="article:author" content="Jiashi">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://s2.loli.net/2023/10/12/1YpmFTXMvhksjLx.png">
  
  
    <meta name="referrer" content="no-referrer-when-downgrade">
  
  
  <title>缓冲区溢出 - Blog from js19</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/css/highlight-dark.css" />
  




  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"jiashi19.gitee.io","root":"/","version":"1.9.5-a","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"follow_dnt":true,"baidu":null,"google":{"measurement_id":null},"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml","include_content_in_search":true};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
  


  
<meta name="generator" content="Hexo 6.3.0"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 70vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>jiashi&#39;s blog</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                <span>首页</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                <span>归档</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                <span>分类</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                <span>标签</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                <span>关于</span>
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              <i class="iconfont icon-search"></i>
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">
              <i class="iconfont icon-dark" id="color-toggle-icon"></i>
            </a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/img/default.png') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="缓冲区溢出"></span>
          
        </div>

        
          
  <div class="mt-3">
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2023-10-12 18:12" pubdate>
          2023年10月12日 晚上
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          1.8k 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          15 分钟
        
      </span>
    

    
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <h1 id="seo-header">缓冲区溢出</h1>
            
            
              <div class="markdown-body">
                
                <h1 id="缓冲区溢出（栈溢出）"><a href="#缓冲区溢出（栈溢出）" class="headerlink" title="缓冲区溢出（栈溢出）"></a>缓冲区溢出（栈溢出）</h1><span id="more"></span>
<h2 id="汇编-函数调用"><a href="#汇编-函数调用" class="headerlink" title="汇编-函数调用"></a>汇编-函数调用</h2><h3 id="函数调用"><a href="#函数调用" class="headerlink" title="函数调用"></a>函数调用</h3><h4 id="函数调用过程"><a href="#函数调用过程" class="headerlink" title="函数调用过程"></a>函数调用过程</h4><ol>
<li><strong>参数入栈</strong>：将参数从右向左依次压入系统栈中</li>
<li><strong>返回地址入栈</strong>：将当前代码区调用指令的下一条指令地址压入栈中，供函数返回时继续执行（在调用call之后）</li>
<li><strong>代码区跳转</strong>：处理器从当前代码区跳转到被调用函数的入口处</li>
<li>栈帧调整：具体包括<br>保存当前栈帧状态值，已备后面恢复本栈帧时使用（<strong>EBP入栈</strong>）<br>将当前栈帧切换到新栈帧。（将ESP值装入EBP，更新栈帧底部）<br>给新栈帧分配空间。（把ESP减去所需空间的大小，抬高栈顶）</li>
<li><strong>函数内的局部变量入栈</strong></li>
</ol>
<h4 id="函数返回"><a href="#函数返回" class="headerlink" title="函数返回"></a>函数返回</h4><p>保存返回值：通常将函数的返回值保存在寄存器EAX中</p>
<p>弹出当前栈帧，恢复上一个栈帧：<br>具体包括：在堆栈平衡的基础上，给ESP加上栈帧的大小，降低栈顶，回收当前栈帧的空间<br>将当前栈帧底部保存的前栈帧<strong>EBP值弹出</strong>，弹给EBP寄存器，恢复出上一个栈帧<br>将函数<strong>返回地址弹出</strong>，弹给<strong>EIP</strong>寄存器</p>
<p> 跳转：按照函数返回地址跳回母函数中继续执行b</p>
<h4 id="三种函数调用方式"><a href="#三种函数调用方式" class="headerlink" title="三种函数调用方式"></a>三种函数调用方式</h4><ul>
<li><p>cdecall：默认的调用方式，调用方平衡栈。解决不定参数的栈平衡问题。</p>
<p>具体体现：在调用完函数后（call），<strong>add esp，xx</strong></p>
</li>
<li><p>stdcall：函数自己平衡栈</p>
</li>
<li><p>fastcall：寄存器传参，函数自己平衡栈</p>
</li>
</ul>
<h3 id="C语言实例分析"><a href="#C语言实例分析" class="headerlink" title="C语言实例分析"></a>C语言实例分析</h3><h4 id="C程序源码（X86-32位编译）"><a href="#C程序源码（X86-32位编译）" class="headerlink" title="C程序源码（X86-32位编译）"></a>C程序源码（X86-32位编译）</h4><figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><code class="hljs c"><span class="hljs-meta">#<span class="hljs-keyword">include</span><span class="hljs-string">&lt;stdio.h&gt;</span></span><br><span class="hljs-type">int</span> <span class="hljs-title function_">add</span><span class="hljs-params">(<span class="hljs-type">int</span> a, <span class="hljs-type">int</span> b)</span><br>&#123;<br>	<span class="hljs-keyword">return</span> a + b;<br>&#125;<br><span class="hljs-type">int</span> <span class="hljs-title function_">main</span><span class="hljs-params">()</span><br>&#123;<br>	<span class="hljs-type">int</span> i = <span class="hljs-number">10</span>;<br>	<span class="hljs-type">int</span> j = <span class="hljs-number">16</span>;<br>	<span class="hljs-built_in">printf</span>(<span class="hljs-string">&quot;%d\n&quot;</span>, add(i,j));<br>	<span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;<br>&#125;<br></code></pre></td></tr></table></figure>



<h4 id="每条语句对寄存器的影响情况"><a href="#每条语句对寄存器的影响情况" class="headerlink" title="每条语句对寄存器的影响情况"></a>每条语句对寄存器的影响情况</h4><p>示例：</p>
<table>
<thead>
<tr>
<th align="center">汇编</th>
<th align="center">影响</th>
<th align="center">受影响的寄存器取值</th>
</tr>
</thead>
<tbody><tr>
<td align="center">mov dword ptr [i],0Ah</td>
<td align="center">eip</td>
<td align="center">eip&#x3D;004118cc</td>
</tr>
<tr>
<td align="center">mov dword ptr [j],10h</td>
<td align="center">eip</td>
<td align="center">eip&#x3D;004118D3</td>
</tr>
<tr>
<td align="center">mov eax,dword ptr [j]</td>
<td align="center">eax</td>
<td align="center">eax&#x3D;00000010</td>
</tr>
<tr>
<td align="center">push eax</td>
<td align="center">esp&#x3D;esp-4</td>
<td align="center">esp&#x3D;0019fdfc</td>
</tr>
<tr>
<td align="center">mov ecx,dwordptr [i]</td>
<td align="center">ecx</td>
<td align="center">ecx&#x3D;0000000a</td>
</tr>
<tr>
<td align="center">push ecx</td>
<td align="center">esp&#x3D;esp-4</td>
<td align="center">esp&#x3D;0019fdf8</td>
</tr>
<tr>
<td align="center">call _add (0411023h)</td>
<td align="center">esp&#x3D;esp-4</td>
<td align="center">esp&#x3D;0019fdf4</td>
</tr>
<tr>
<td align="center">push ebp</td>
<td align="center">esp&#x3D;esp-4</td>
<td align="center">esp&#x3D;0019fdf0</td>
</tr>
<tr>
<td align="center">mov ebp,esp</td>
<td align="center">ebp&#x3D;esp</td>
<td align="center">ebp&#x3D;0019fdf0</td>
</tr>
<tr>
<td align="center">mov eax,dword ptr [a]</td>
<td align="center">eax</td>
<td align="center">eax&#x3D;0000000a</td>
</tr>
<tr>
<td align="center">add eax,dword ptr [b]</td>
<td align="center">eax&#x3D;eax+16</td>
<td align="center">eax&#x3D;0000001a</td>
</tr>
<tr>
<td align="center">mov esp,ebp</td>
<td align="center">esp&#x3D;ebp</td>
<td align="center">esp&#x3D;0019fdf0</td>
</tr>
<tr>
<td align="center">pop ebp</td>
<td align="center">esp&#x3D;esp+4;ebp</td>
<td align="center">esp&#x3D;0019fdf4;ebp&#x3D;0019fee4</td>
</tr>
<tr>
<td align="center">ret</td>
<td align="center">eip;esp&#x3D;esp+4</td>
<td align="center">eip&#x3D;004118e0;esp&#x3D;0019fdf8</td>
</tr>
<tr>
<td align="center">add esp,8</td>
<td align="center">esp&#x3D;esp+8</td>
<td align="center">esp&#x3D;0019fe00</td>
</tr>
<tr>
<td align="center"></td>
<td align="center"></td>
<td align="center"></td>
</tr>
<tr>
<td align="center"></td>
<td align="center"></td>
<td align="center"></td>
</tr>
</tbody></table>
<h2 id="栈溢出"><a href="#栈溢出" class="headerlink" title="栈溢出"></a>栈溢出</h2><h3 id="栈溢出原理"><a href="#栈溢出原理" class="headerlink" title="栈溢出原理"></a>栈溢出原理</h3><p>当程序运行时，计算机会在内存区域中开辟一段连续的内存块，包括代码段、数据段和堆栈段三部分。</p>
<p><img src="https://s2.loli.net/2023/10/12/1YpmFTXMvhksjLx.png" srcset="/img/loading.gif" lazyload alt="image-20231012174638214"></p>
<p>程序在内存中的存放形式如下图。</p>
<img src="https://s2.loli.net/2023/10/12/lfHpyKtexSC4oq1.png" srcset="/img/loading.gif" lazyload alt="image-20231012174726881" style="zoom: 75%;" />

<img src="https://s2.loli.net/2023/10/12/NxS5aRwYLUHsAuv.png" srcset="/img/loading.gif" lazyload alt="image-20231012175036478" style="zoom:75%;" />

<h3 id="函数调用-栈的变化"><a href="#函数调用-栈的变化" class="headerlink" title="函数调用&amp;栈的变化"></a>函数调用&amp;栈的变化</h3><p>当一个函数被调用时，栈中压入情况如下：</p>
<p><img src="https://s2.loli.net/2023/10/12/YxiulWDVBF9fSZw.png" srcset="/img/loading.gif" lazyload alt="image-20231012175204933"></p>
<p>在局部变量往高，是前一个调用函数的EBP，接下来就是返回地址。 如果局部变量发生溢出，很有可能会覆盖掉EBP甚至RET(返回地址)，这就是缓冲区溢出攻击的“奥秘”所在。 </p>
<p>程序中发生函数调用时，计算机做如下操作：</p>
<ol>
<li>首先把指令寄存器EIP（它指向当前CPU将要运行的下一条指令的地址）中的内容压入栈，作为程序的返回地址（下文中用RET表示）；</li>
<li>之后放入栈的是基址寄存器EBP，它指向当前函数栈帧（stack frame）的底部；</li>
<li>然后把当前的栈指针ESP拷贝到EBP，作为新的基地址，最后为本地变量的动态存储分配留出一定空间，并把ESP减去适当的数值。</li>
</ol>
<h3 id="溢出攻击的基本流程"><a href="#溢出攻击的基本流程" class="headerlink" title="溢出攻击的基本流程"></a>溢出攻击的基本流程</h3><p><img src="https://s2.loli.net/2023/10/12/hQ2SNwo9XJYKskO.png" srcset="/img/loading.gif" lazyload alt="image-20231012180726395"></p>
<p>关键技术：</p>
<ul>
<li><p>溢出点定位</p>
<p>探测法；反汇编分析</p>
</li>
<li><p>覆盖执行控制地址</p>
<p>覆盖返回地址</p>
</li>
<li><p>覆盖异常处理结构</p>
</li>
<li><p>跳转地址的确定</p>
</li>
<li><p>Shellcode定位和跳转</p>
</li>
</ul>

                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/categories/%E7%BD%91%E7%BB%9C%E6%94%BB%E9%98%B2/" class="category-chain-item">网络攻防</a>
  
  

      </span>
    
  
</span>

    </div>
  
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>缓冲区溢出</div>
      <div>https://jiashi19.gitee.io/2023/10/12/缓冲区溢出/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>Jiashi</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2023年10月12日</div>
        </div>
      
      
      
        <div class="license-meta-item">
          <div>许可协议</div>
          <div>
            
              
              
                <a class="print-no-link" target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
                  <span class="hint--top hint--rounded" aria-label="BY - 署名">
                    <i class="iconfont icon-by"></i>
                  </span>
                </a>
              
            
          </div>
        </div>
      
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2023/10/16/%E6%81%B6%E6%84%8F%E4%BB%A3%E7%A0%81%E5%88%86%E6%9E%90/" title="恶意代码分析">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">恶意代码分析</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2023/10/03/%E7%88%86%E7%A0%B4-token%E7%BB%95%E8%BF%87/" title="爆破-token绕过">
                        <span class="hidden-mobile">爆破-token绕过</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header">
    <i class="iconfont icon-list"></i>
    <span>目录</span>
  </p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
    </div>
  
  
    <div class="statistics">
  
  

  
    
      <span id="busuanzi_container_site_pv" style="display: none">
        总访问量 
        <span id="busuanzi_value_site_pv"></span>
         次
      </span>
    
    
      <span id="busuanzi_container_site_uv" style="display: none">
        总访客数 
        <span id="busuanzi_value_site_uv"></span>
         人
      </span>
    
    
  
</div>

  
  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.4/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/js/img-lazyload.js" ></script>
  




  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.20.1/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init(Object.assign({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      scrollSmooth    : true,
      includeTitleTags: true,
      headingsOffset  : -boardTop,
    }, CONFIG.toc));
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }

    Fluid.events.registerRefreshCallback(function() {
      if ('tocbot' in window) {
        tocbot.refresh();
        var toc = jQuery('#toc');
        if (toc.length === 0 || !tocbot) {
          return;
        }
        if (toc.find('.toc-list-item').length > 0) {
          toc.css('visibility', 'visible');
        }
      }
    });
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.11/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));

    Fluid.events.registerRefreshCallback(function() {
      if ('anchors' in window) {
        anchors.removeAll();
        var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
        var res = [];
        for (var item of el) {
          res.push('.markdown-body > ' + item.trim());
        }
        if (CONFIG.anchorjs.placement === 'left') {
          anchors.options.class = 'anchorjs-link-left';
        }
        anchors.add(res.join(', '));
      }
    });
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/js/local-search.js" ></script>

  <script defer src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" ></script>





<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
</body>
</html>
